﻿using Quartz;

namespace AVCJobDispatcherLinux.TaskJobEngine
{
    internal class JobTriggerConver
    {
        public static TriggerKey GetTriggerKey(string name, string group) => new TriggerKey($"{name}Trigger", group);
        public static JobKey GetJobKey(string name, string group) => new JobKey($"{name}Job", group);
        public static TriggerKey GetTriggerKey(JobInfo entity) => new TriggerKey($"{entity.Name}Trigger", entity.GroupName);
        public static JobKey GetJobKey(JobInfo entity) => new JobKey($"{entity.Name}Job", entity.GroupName);
        public static string StateChines(TriggerState triggerState)
        {
            //2018-08-02 当设置为 不是并发 的job 时 返回的总是 Blocked 所以先暂时默认为正常
            switch (triggerState)
            {
                case TriggerState.None:
                    return "没有";
                case TriggerState.Normal:
                case TriggerState.Blocked:
                    return "正常";
                case TriggerState.Paused:
                    return "已暂停";
                case TriggerState.Complete:
                    return "完成";
                case TriggerState.Error:
                    return "错误";

                default:
                    return $"未知，{triggerState}";
            }
        }
    }
}
